home *** CD-ROM | disk | FTP | other *** search
Text File | 1996-05-01 | 4.1 KB | 145 lines | [TEXT/MPS ] |
- {
- File: IOIterator.p
-
- Contains: xxx put contents here xxx
-
- Version: Technology: xxx put the technology version here xxx
- Release: Universal Interfaces 3.0d3 on Copland DR1
-
- Copyright: © 1984-1996 by Apple Computer, Inc. All rights reserved.
-
- Bugs?: If you find a problem with this file, send the file and version
- information (from above) and the problem description to:
-
- Internet: apple.bugs@applelink.apple.com
- AppleLink: APPLE.BUGS
-
- }
- {$IFC UNDEFINED UsingIncludes}
- {$SETC UsingIncludes := 0}
- {$ENDC}
-
- {$IFC NOT UsingIncludes}
- UNIT IOIterator;
- INTERFACE
- {$ENDC}
-
- {$IFC UNDEFINED __IOITERATOR__}
- {$SETC __IOITERATOR__ := 1}
-
- {$I+}
- {$SETC IOIteratorIncludes := UsingIncludes}
- {$SETC UsingIncludes := 1}
-
- {$IFC UNDEFINED __TYPES__}
- {$I Types.p}
- {$ENDC}
-
- {$PUSH}
- {$ALIGN MAC68K}
- {$LibExport+}
-
- {$IFC FOR_SYSTEM8_PREEMPTIVE }
- { typedefs }
-
- TYPE
- IteratorDescVersion = UInt32;
- {
- ###########################################################
- How to use the IteratorDescVersion
- ###########################################################
- Each family will define a k<Family>CurrentIteratorDescVersion constant
- in its *.i file. The client will check the returned IteratorDescVersion
- value against this constant to make sure there's no version mismatch
- problem.
- Common data structure used by all I/O family iterators
- }
- IODeviceRefPtr = ^IODeviceRef;
- IODeviceRef = RECORD
- contents: ARRAY [0..3] OF UInt32;
- END;
-
- {
- a family unique reference number for returned devices.
- this is an opaque field, for now, use the name registry Ref value of the
- device in question.
- The IODeviceRef is unique within a family, NOT unique across the entire I/O name space
- }
- IOCommonInfoPtr = ^IOCommonInfo;
- IOCommonInfo = RECORD
- ref: IODeviceRef;
- versionNumber: IteratorDescVersion;
- END;
-
- { IteratorDescVersion versionNumber: version number of the family specific IOIteratorData }
- {$ENDC}
- {
- ###########################################################
- How to copy name registry ref --> IODeviceRef
- ###########################################################
- (
- IOCommonInfo DeviceData;
- RegEntryRef *anotherReg, *whichDevice;
- anotherReg = (RegEntryRef *)&DeviceData;
- *anotherReg = *whichDevice;
- )
- ###########################################################
- How to define a family specific IOIteratorData structure
- ###########################################################
- struct <FamilyName>IOIteratorData
- (
- IOCommonInfo IOCI;
- // common data for all families
- f1, // Individual family specific data
- f2,
- etc...
- );
- Example 1: (A possible implementation for the SCSI iterator)
- struct SCSIIOIteratorData
- (
- IOCommonInfo IOCI;
- // common data for all families
- UInt32 BusID;
- UInt32 TargetID;
- UInt32 LUN;
- );
- ###########################################################
- How to define a family specific iterator function
- ###########################################################
- OSStatus <FamilyName><IterationSpecification>GetDeviceData
- ( ItemCount requestItemCount,
- FamilyIteratorData *(&<FamilyName>IOIteratorDataArray[requestItemCount]),
- ItemCount *totalItemCountPtr );
-
- For returning ALL devices that the family have access to
- OSStatus <FamilyName><IterationSpecification>GetDeviceData
- ( UInt32 familySpecificParam,
- ItemCount requestItemCount,
- FamilyIteratorData *(&<FamilyName>IOIteratorDataArray[requestItemCount]),
- ItemCount *totalItemCountPtr );
-
- For returning a subset of devices, filtered by some family specific parameters
- EXAMPLES:
- OSStatus SCSIGetDeviceData
- ( ItemCount requestItemCount,
- ItemCount *totalItemCountPtr,
- SCSIIteratorData *(&SCSIIOIteratorDataArray[requestItemCount]));
- To get all scsi devices
- OSStatus SCSIBusGetDeviceData
- ( UInt32 BusID,
- ItemCount requestItemCount,
- ItemCount *totalItemCountPtr,
- SCSIIteratorData *(&SCSIIOIteratorDataArray[requestItemCount]));
- To get all scsi devices that matches the input BusID
- }
- {$ALIGN RESET}
- {$POP}
-
- {$SETC UsingIncludes := IOIteratorIncludes}
-
- {$ENDC} {__IOITERATOR__}
-
- {$IFC NOT UsingIncludes}
- END.
- {$ENDC}
-